package org.fioma.tree.suffixTree.memory.ukkonen;

import org.fioma.tree.suffixTree.memory.SimpleInternalSuffixNodeMemory;

public class SimpleUkkonenInternalSuffixNodeMemory extends
		SimpleInternalSuffixNodeMemory<UkkonenInternalSuffixNodeMemory, UkkonenLeafSuffixNodeMemory, UkkonenSuffixNodeMemory> implements
		UkkonenInternalSuffixNodeMemory {

	public SimpleUkkonenInternalSuffixNodeMemory(long pos, SimpleUkkonenSuffixTreeHandlerMemory treeHandler) {
		super(pos, treeHandler);
	}

	@Override
	public UkkonenInternalSuffixNodeMemory getSuffixLink() {
		long slAddress = ((SimpleUkkonenSuffixTreeHandlerMemory) getTreeHandler()).getMemory().getSuffixLinkAddress(getPos());
		return this.getTreeHandler().createInternalNode(slAddress);
	}

	@Override
	public void setSuffixLink(UkkonenInternalSuffixNodeMemory suffixLink) {
		((SimpleUkkonenSuffixTreeHandlerMemory) getTreeHandler()).getMemory().setSuffixLinkAddress(getPos(), suffixLink.getPos());
	}

}
